<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
    <form th:action="@{/update}" method="post">
        <!--隐藏查出来的empId-->
        <input type="hidden" th:value="${emp.getId()}">
        <div class="form-group">
            <label>LastName</label>
            <input name="lastName" th:value="${emp.getLastName()}" type="text" class="form-control"
                   id="exampleInputEmail1" placeholder="lastName">
        </div>
        <div class="form-group">
            <label>Email</label>
            <input name="email" th:value="${emp.getEmail()}" type="email"
                   class="form-control" id="exampleInputPassword1" placeholder="email">
        </div>
        <div class="form-group">
            <label>Gender</label>
            <div class="form-check form-check-inline">
                <input th:checked="${emp.getGender()==1}" class="form-check-input" type="radio"
                       value="1" name="gender"/>
                <label class="form-check-label">男</label>
            </div>
            <div class="form-check form-check-inline">
                <input th:checked="${emp.getGender()==0}" class="form-check-input" type="radio"
                       value="0" name="gender"/>
                <label class="form-check-label">女</label>
            </div>
        </div>
        <div class="form-group">
            <label>Department</label>
            <!--提交的value是id-->
            <select name="department.id" class="form-control">
                <!--回显：部门id等于员工部门的id-->
                <option th:each="dept:${departments}"
                        th:selected="${dept.getId()==emp.getDepartment().getId()}"
                        th:text="${dept.getDepartName()}"
                        th:value="${dept.getId()}"></option>
            </select>
        </div>
        <div class="form-group">
            <label>Birth</label>
            <!--日期回显，需要更改默认格式-->
            <input th:value="${#dates.format(emp.getBirth(),'yyyy-MM-dd HH:mm:ss')}" name="birth" type="text"
                   class="form-control" placeholder="yyyy-MM-dd">
        </div>
        <button type="submit" class="btn btn-default">修改</button>
    </form>
</main>

</body>
</html>